﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace dacli.modelos.dao
{
    public class TiposPagoDAO : EntidadDao
    {
        public TiposPago tiposPago;
        public TiposPagoDAO()
            : base("tipo_pago") 
        { 

        }
        public TiposPago asignarId(long id)
        {
            this.consultar("id=" + id);
            return this.tiposPago;
        }   


        public override long incluir()
        {
            throw new NotImplementedException();
        }

        public override long modificar()
        {
            throw new NotImplementedException();
        }

        public override long eliminar()
        {
            throw new NotImplementedException();
        }

        public override bool consultar(string filtro)
        {
            string sql = "SELECT * FROM " + this.tabla + " WHERE " + filtro;
            System.Data.SqlClient.SqlDataReader reader = conexion.consultar(sql);
            if (reader.Read())
            {
                if (tiposPago == null)
                {
                    tiposPago = new TiposPago();
                }
                try
                {
                    tiposPago.id = reader.GetInt32(reader.GetOrdinal("id"));
                    tiposPago.nombre = reader.GetString(reader.GetOrdinal("nombre"));
                    tiposPago.observacion = reader.GetBoolean(reader.GetOrdinal("observacion"));
                    return true;
                }
                catch (Exception e)
                { 

                }
            }
            return false;
        }
    }
}
